// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.Inference;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.Json.OpenShiftAiServiceSettingsConverter))]
public sealed partial class OpenShiftAiServiceSettings
{
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public OpenShiftAiServiceSettings(string apiKey, string url)
	{
		ApiKey = apiKey;
		Url = url;
	}
#if NET7_0_OR_GREATER
	public OpenShiftAiServiceSettings()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	[System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")]
	public OpenShiftAiServiceSettings()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal OpenShiftAiServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	/// <summary>
	/// <para>
	/// A valid API key for your OpenShift AI endpoint.
	/// Can be found in <c>Token authentication</c> section of model related information.
	/// </para>
	/// </summary>
	public
#if NET7_0_OR_GREATER
	required
#endif
	string ApiKey { get; set; }

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the maximum number of tokens per input before chunking occurs.
	/// </para>
	/// </summary>
	public int? MaxInputTokens { get; set; }

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// Refer to the hosted model's documentation for the name if needed.
	/// Service has been tested and confirmed to be working with the following models:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// For <c>text_embedding</c> task - <c>gritlm-7b</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// For <c>completion</c> and <c>chat_completion</c> tasks - <c>llama-31-8b-instruct</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// For <c>rerank</c> task - <c>bge-reranker-v2-m3</c>.
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public string? ModelId { get; set; }

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the OpenShift AI API.
	/// By default, the <c>openshift_ai</c> service sets the number of requests allowed per minute to 3000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; }

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the similarity measure. One of cosine, dot_product, l2_norm.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiSimilarityType? Similarity { get; set; }

	/// <summary>
	/// <para>
	/// The URL of the OpenShift AI hosted model endpoint.
	/// </para>
	/// </summary>
	public
#if NET7_0_OR_GREATER
	required
#endif
	string Url { get; set; }
}

public readonly partial struct OpenShiftAiServiceSettingsDescriptor
{
	internal Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public OpenShiftAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public OpenShiftAiServiceSettingsDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings(Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor descriptor) => descriptor.Instance;

	/// <summary>
	/// <para>
	/// A valid API key for your OpenShift AI endpoint.
	/// Can be found in <c>Token authentication</c> section of model related information.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor ApiKey(string value)
	{
		Instance.ApiKey = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the maximum number of tokens per input before chunking occurs.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor MaxInputTokens(int? value)
	{
		Instance.MaxInputTokens = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// Refer to the hosted model's documentation for the name if needed.
	/// Service has been tested and confirmed to be working with the following models:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// For <c>text_embedding</c> task - <c>gritlm-7b</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// For <c>completion</c> and <c>chat_completion</c> tasks - <c>llama-31-8b-instruct</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// For <c>rerank</c> task - <c>bge-reranker-v2-m3</c>.
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor ModelId(string? value)
	{
		Instance.ModelId = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the OpenShift AI API.
	/// By default, the <c>openshift_ai</c> service sets the number of requests allowed per minute to 3000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value)
	{
		Instance.RateLimit = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the OpenShift AI API.
	/// By default, the <c>openshift_ai</c> service sets the number of requests allowed per minute to 3000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor RateLimit()
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null);
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the OpenShift AI API.
	/// By default, the <c>openshift_ai</c> service sets the number of requests allowed per minute to 3000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor RateLimit(System.Action<Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor>? action)
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action);
		return this;
	}

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the similarity measure. One of cosine, dot_product, l2_norm.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor Similarity(Elastic.Clients.Elasticsearch.Inference.OpenShiftAiSimilarityType? value)
	{
		Instance.Similarity = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The URL of the OpenShift AI hosted model endpoint.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor Url(string value)
	{
		Instance.Url = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings Build(System.Action<Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.OpenShiftAiServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}